﻿using EFFC.Frame.Net.Module.Extend.EWRA.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EFFC.Extends.LinqDLR2SQL;
using EFFC.Frame.Net.Unit.DB;
using System.IO;
using EFFC.Frame.Net.Base.Common;
using EFFC.Frame.Net.Base.Data.Base;
using ICPFrameLib.Business;
using ICPFrameLib.Attributes;
using EFFC.Frame.Net.Unit.DB.Parameters;
using XHRPMIS.Common;
using EFFC.Frame.Net.Base.Constants;
using EFFC.Frame.Net.Base.Data;
using ICPFrameLib.Common;

namespace XHRPMIS.Business.v1._0
{
    public class WorkFlowTask : MyRestLogic
    {
       
      
        [EWRAAuth(true)]
        [EWRARoute("post", "/WorkFlowTask/GenWorkFlowTask")]        
        //[EWRAAddInput("WorkFlowAccessToken", "string", "流程引擎访问Token，流程引擎端调用时需要传值", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.HeaderData, false)]
        [EWRAAddInput("Title", "string", "主题", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("Category", "string", "类别", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("InstanceKey", "string", "流程实例主键", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("FormKey", "string", "流程动态表单主键", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("UserID", "string", "用户ID", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("Status", "string", "任务状态：待办，已办", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)] 
        [EWRARouteDesc("流程任务：新建流程任务")]
        [EWRAOutputDesc("返回结果", @"{
                code = 'success',
                msg = '创建成功'
            }")]
        public object GenWorkFlowTask()
        {
            SetCacheEnable(false);
            var up = DB.NewMetaUnitParameter();

            var w = from c in DB.LamdaTable(up, "EXTEND_WORK_FLOW_TASKS", "c")
                    where c.InstanceKey == PostDataD.InstanceKey && c.FormKey == PostDataD.FormKey && c.UserID == PostDataD.UserID
                    select c;



            if (!w.IsExists(up))
            {
                dynamic task = new
                {
                    TID = Guid.NewGuid(),
                    Title = PostDataD.Title,
                    Category = PostDataD.Category,
                    InstanceKey = PostDataD.InstanceKey,
                    FormKey = PostDataD.FormKey,
                    UserID = PostDataD.UserID,
                    Status = PostDataD.Status,
                    Add_Id = TokenPayLoad.ID,
                    Add_IP = ClientInfo.IP,
                    Add_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Last_Id = TokenPayLoad.ID,
                    Last_IP = ClientInfo.IP,
                    Last_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                };
                DB.QuickInsert(up, "EXTEND_WORK_FLOW_TASKS", task);
            }
            else
            {
                var task = w.GetQueryList(up).FirstOrDefault();
                task.SetValue("Title",PostDataD.Title);
                task.SetValue("Category", PostDataD.Category);
                task.SetValue("InstanceKey", PostDataD.InstanceKey);
                task.SetValue("FormKey", PostDataD.FormKey);
                task.SetValue("UserID", PostDataD.UserID);
                task.SetValue("Status", PostDataD.Status);
                task.SetValue("Last_Id", TokenPayLoad.ID);
                task.SetValue("Add_IP", ClientInfo.IP);
                task.SetValue("Add_Time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                DB.QuickUpdate(up, "EXTEND_WORK_FLOW_TASKS", task, new { TID = task.GetValue("TID").ToString() });
            }
             
            return new
            {
                code = "success",
                msg = "创建成功"
            };

        }

        [EWRAAuth(true)]
        [EWRARoute("post", "/WorkFlowTask/GenCurNodeWorkFlowTask")] 
        [EWRAAddInput("TID", "string", "主键ID", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("Title", "string", "主题", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("Category", "string", "类别", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("InstanceKey", "string", "流程实例主键", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("FormKey", "string", "流程动态表单主键", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("UserID", "string", "用户ID", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("Status", "string", "任务状态：待办，已办", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("Extend", "string", "扩展字段", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRARouteDesc("流程任务：新建当前节点流程任务")]
        [EWRAOutputDesc("返回结果", @"{
                code = 'success',
                msg = '创建成功'
            }")]
        public object GenCurNodeWorkFlowTask()
        {
            SetCacheEnable(false);
            var up = DB.NewMetaUnitParameter();

            var wlist = (from c in DB.LamdaTable(up, "EXTEND_WORK_FLOW_TASKS", "c")
                    where c.InstanceKey == PostDataD.InstanceKey && c.FormKey == PostDataD.FormKey && c.UserID == PostDataD.UserID
                    orderby c.add_time descending 
                    select c).GetQueryList(up);
             
            dynamic task;

            if (wlist.Count==0)
            {
                task = FrameDLRObject.CreateInstance(new
                {
                    TID = Guid.NewGuid(),
                    Title = PostDataD.Title,
                    Category = PostDataD.Category,
                    InstanceKey = PostDataD.InstanceKey,
                    FormKey = PostDataD.FormKey,
                    UserID = PostDataD.UserID,
                    Status = PostDataD.Status,
                    Add_Id = TokenPayLoad.ID,
                    Add_IP = ClientInfo.IP,
                    Add_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Last_Id = TokenPayLoad.ID,
                    Last_IP = ClientInfo.IP,
                    Last_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                });
                DB.QuickInsert(up, "EXTEND_WORK_FLOW_TASKS", task);
            }
            else
            {
              
                task = wlist.FirstOrDefault();
                task.SetValue("Title", PostDataD.Title);
                task.SetValue("Category", PostDataD.Category);
                task.SetValue("InstanceKey", PostDataD.InstanceKey);
                task.SetValue("FormKey", PostDataD.FormKey);
                task.SetValue("UserID", PostDataD.UserID);
                task.SetValue("Status", PostDataD.Status);
                task.SetValue("Last_Id", TokenPayLoad.ID);
                task.SetValue("Add_IP", ClientInfo.IP);
                task.SetValue("Add_Time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));               
                DB.QuickUpdate(up, "EXTEND_WORK_FLOW_TASKS", task, new { TID = task.GetValue("TID").ToString() });
            }

            if (task != null)
            {
                task.add_time = DateTimeStd.IsDateTimeThen(task.add_time, "yyyy-MM-dd HH:mm:ss");
                task.last_time = DateTimeStd.IsDateTimeThen(task.last_time, "yyyy-MM-dd HH:mm:ss");
            }
            return new
            {
                code = "success",
                msg = "创建成功",
                data= task
            };

        }

        [EWRAAuth(true)]
        [EWRARoute("post", "/WorkFlowTask/GenNextNodeWorkFlowTask")]
        [EWRAAddInput("Title", "string", "主题", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("Category", "string", "类别", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("InstanceKey", "string", "流程实例主键", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("FormKey", "string", "流程动态表单主键", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("Status", "string", "任务状态：待办，已办", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("Extend", "string", "扩展字段", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("ActionCode", "string", "行为编码", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("UserID", "string", "用户ID", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("NextTitle", "string", "主题", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("NextCategory", "string", "类别", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("NextStatus", "string", "任务状态：待办，已办", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("IsCountersign", "string", "是否会签：1会签，2非会签", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("NextExtend", "string", "扩展字段", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRARouteDesc("流程任务：新建下一个节点流程任务")]
        [EWRAOutputDesc("返回结果", @"{
                code = 'success',
                msg = '创建成功'
            }")]
        public object GenNextNodeWorkFlowTask()
        {
            SetCacheEnable(false);
            var up = DB.NewMetaUnitParameter();

            #region ---更新当前节点任务状态 ---
            var cn = from c in DB.LamdaTable(up, "EXTEND_WORK_FLOW_TASKS", "c")
                    where c.InstanceKey == PostDataD.InstanceKey && c.FormKey == PostDataD.FormKey && c.UserID == PostDataD.UserID && c.Status != WorkFlowTaskStatus.Done  
                     select c;

            var cns = new List<FrameDLRObject>();

            if (string.IsNullOrEmpty(PostDataD.Extend))
            {
                cns = (from c in DB.LamdaTable(up, "EXTEND_WORK_FLOW_TASKS", "c")
                       where c.InstanceKey == PostDataD.InstanceKey && c.FormKey == PostDataD.FormKey && c.Status != WorkFlowTaskStatus.Done
                       select c).GetQueryList(up).ToList();

            } else
            {
                cns = (from c in DB.LamdaTable(up, "EXTEND_WORK_FLOW_TASKS", "c")
                       where c.InstanceKey == PostDataD.InstanceKey && c.FormKey == PostDataD.FormKey && c.Status != WorkFlowTaskStatus.Done && c.Extend == PostDataD.Extend
                       select c).GetQueryList(up).ToList();
            }

            var isCountersign = PostDataD.IsCountersign == ((int)CountersignStatus.Yes).ToString();
            var onlyOneTask = cns.Count() == 1;

            if (cns != null && cns.Count() > 1)
            {
                if (isCountersign)
                { 
                    dynamic curTask = cn.GetQueryList(up).FirstOrDefault();
                    curTask.SetValue("Status", PostDataD.Status);
                    curTask.SetValue("Extend", PostDataD.Extend);
                    curTask.SetValue("Last_Id", TokenPayLoad.ID);
                    curTask.SetValue("Last_IP", ClientInfo.IP);
                    curTask.SetValue("Last_Time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                    DB.QuickUpdate(up, "EXTEND_WORK_FLOW_TASKS", curTask, new { TID = curTask.GetValue("TID").ToString() });
                    //会签节点且当前代办人超过1人，则只更新本人任务状态
                    if (PostDataD.Status == WorkFlowTaskStatus.Done)
                    {
                        return new
                        {
                            code = "success",
                            msg = "创建成功"
                        };
                    }
                }
            }

            if (cn.IsExists(up))
            {
                if (!isCountersign || onlyOneTask)
                {
                    foreach (var s in cns)
                    {
                        s.SetValue("Status", PostDataD.Status);
                        //s.SetValue("Extend", PostDataD.Extend);
                        s.SetValue("Last_Id", TokenPayLoad.ID);
                        s.SetValue("Last_IP", ClientInfo.IP);
                        s.SetValue("Last_Time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        DB.QuickUpdate(up, "EXTEND_WORK_FLOW_TASKS", s, new { TID = s.GetValue("TID").ToString() });
                    }
                }
            } else {
                dynamic curTask = new
                {
                    TID = Guid.NewGuid(),
                    Title = PostDataD.Title,
                    Category = PostDataD.Category,
                    InstanceKey = PostDataD.InstanceKey,
                    FormKey = PostDataD.FormKey,
                    UserID = PostDataD.UserID,
                    Status = PostDataD.Status,
                    Extend = PostDataD.Extend,
                    Add_Id = TokenPayLoad.ID,
                    Add_IP = ClientInfo.IP,
                    Add_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Last_Id = TokenPayLoad.ID,
                    Last_IP = ClientInfo.IP,
                    Last_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                };
                DB.QuickInsert(up, "EXTEND_WORK_FLOW_TASKS", curTask);
            }
            #endregion

            #region --- 生成下一个节点任务 --- 
            WFAccess wfAccess = new WFAccess();
            
           var result =  wfAccess.Post(@"WorkFlowEngine/NextNodeUsersForm", new { PrimaryKey=PostDataD.InstanceKey, ActionCode= PostDataD.ActionCode, UserID = PostDataD.UserID, FormKey=PostDataD.FormKey, ExtendData = PostDataD.Extend },null);
            if (result == null)
            {
                return new
                {
                    code = "failed",
                    msg = "执行失败：返回结果为空"
                };
            }
            else if (result.StartsWith("Failed:"))
            {
                return new
                {
                    code = "failed",
                    msg = $"执行失败：{result}"
                };
            }
            else
            {
                 var objResult = FrameDLRObject.IsJsonThen(result, null, FrameDLRFlags.SensitiveCase);
                 if(((FrameDLRObject)objResult.GetValue("result")).GetValue("code") != null && ((FrameDLRObject)objResult.GetValue("result")).GetValue("code").ToString()== "success"){
                    var users = ((FrameDLRObject)objResult.GetValue("result")).GetValue("users") as IEnumerable<dynamic>;
                    //var formKey = ((FrameDLRObject)objResult.GetValue("result")).GetValue("formKey").ToString();
                    if (users != null)
                    {
                        foreach(dynamic u in users)
                        {
                            if (PostDataD.ActionCode != ActionCode.SubmitPending)
                            {
                                var uq = from c in DB.LamdaTable(up, "EXTEND_WORK_FLOW_TASKS", "c")
                                         where c.InstanceKey == PostDataD.InstanceKey && c.FormKey == u.FormKey && c.UserID == u.UserID && c.Status != WorkFlowTaskStatus.Done
                                         select c;

                                if (!uq.IsExists(up))
                                {
                                    dynamic task = new
                                    {
                                        TID = Guid.NewGuid(),
                                        Title = PostDataD.NextTitle,
                                        Category = PostDataD.NextCategory,
                                        InstanceKey = PostDataD.InstanceKey,
                                        FormKey = u.FormKey,
                                        UserID = u.UserID,
                                        Status = PostDataD.NextStatus,
                                        Extend = PostDataD.NextExtend,
                                        Add_Id = TokenPayLoad.ID,
                                        Add_IP = ClientInfo.IP,
                                        Add_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                        Last_Id = TokenPayLoad.ID,
                                        Last_IP = ClientInfo.IP,
                                        Last_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                                    };
                                    DB.QuickInsert(up, "EXTEND_WORK_FLOW_TASKS", task);
                                }
                                else
                                {
                                    var tasks = uq.GetQueryList(up).ToList();
                                    foreach (var task in tasks)
                                    {
                                        task.SetValue("Status", PostDataD.NextStatus);
                                        //task.SetValue("Extend", PostDataD.NextExtend);
                                        task.SetValue("Last_Id", TokenPayLoad.ID);
                                        task.SetValue("Last_IP", ClientInfo.IP);
                                        task.SetValue("Last_Time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                                        DB.QuickUpdate(up, "EXTEND_WORK_FLOW_TASKS", task, new { TID = task.GetValue("TID").ToString() });
                                    }
                                }
                            } else
                            {
                                //针对延期申请的可以产生多个task
                                dynamic task = new
                                {
                                    TID = Guid.NewGuid(),
                                    Title = PostDataD.NextTitle,
                                    Category = PostDataD.NextCategory,
                                    InstanceKey = PostDataD.InstanceKey,
                                    FormKey = u.FormKey,
                                    UserID = u.UserID,
                                    Status = PostDataD.NextStatus,
                                    Extend = PostDataD.NextExtend,
                                    Add_Id = TokenPayLoad.ID,
                                    Add_IP = ClientInfo.IP,
                                    Add_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                    Last_Id = TokenPayLoad.ID,
                                    Last_IP = ClientInfo.IP,
                                    Last_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                                };
                                DB.QuickInsert(up, "EXTEND_WORK_FLOW_TASKS", task);
                            }
                        }
                    } 
                }
                return new
                {
                    code = "success",
                    msg = "创建成功"
                };
            }
            #endregion

        }

        [EWRAAuth(true)]
        [EWRARoute("post", "/WorkFlowTask/RemoveWorkFlowTask")]
        [EWRAAddInput("TID", "string", "主键ID", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)] 
        [EWRARouteDesc("流程任务：移除流程任务")]
        [EWRAOutputDesc("返回结果", @"{
                code = 'success',
                msg = '移除成功'
            }")]
        public object RemoveWorkFlowTask()
        {
            SetCacheEnable(false);
            var up = DB.NewMetaUnitParameter();

            var w = from c in DB.LamdaTable(up, "EXTEND_WORK_FLOW_TASKS", "c")
                    where c.TID == PostDataD.TID
                    select c; 

            if (!w.IsExists(up))
            {
                return new
                {
                    code = "failed",
                    msg = "任务不存在成功"
                };
            }
            else
            {
                var task = w.GetQueryList(up).FirstOrDefault(); 
                DB.QuickDelete(up, "EXTEND_WORK_FLOW_TASKS", new { TID = PostDataD.TID });

                return new
                {
                    code = "success",
                    msg = "移除成功"
                };
            }

        }

        [EWRAAuth(true)]
        [EWRARoute("post", "/WorkFlowTask/DoneWorkFlowTask")]
        [EWRAAddInput("WorkFlowAccessToken", "string", "流程引擎访问Token，流程引擎端调用时需要传值", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.HeaderData, false)] 
        [EWRAAddInput("TID", "string", "任务主键", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)] 
        [EWRARouteDesc("流程任务：更新任务状态为已办")]
        [EWRAOutputDesc("返回结果", @"{
                code = 'success',
                msg = '更新成功'
            }")]
        public object DoneWorkFlowTask()
        {
            SetCacheEnable(false);
 
            var up = DB.NewMetaUnitParameter();

            DB.QuickUpdate(up, "EXTEND_WORK_FLOW_TASKS",new { GCNotificationStatus="已办"},new { TID = new Guid( ComFunc.nvl( PostDataD.TID))});

            return new
            {
                code = "success",
                msg = "更新成功"
            };

        }
        [EWRAAuth(false)]
        [EWRARoute("post", "/WorkFlowTask/ToDoList")]
        [EWRAAddInput("UserID", "string", "用户ID", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("limit", "int", "页面条数", "10", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("page", "int", "当前页码", "1", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRARouteDesc("流程任务：获取待办列表")]
        [EWRAOutputDesc("返回结果", @"{
                    code:'success',
                     msg:'',
                     data:[
                         {
                            ID:记录ID， 
                            Name:客户名称 
                         }]
        }")]
        public object ToDoList()
        {
            SetCacheEnable(false);
            var up = DB.NewMetaUnitParameter();
            var list = (from a in DB.LamdaTable(up, "EXTEND_WORK_FLOW_TASKS", "a") 
                        where a.Status == "待办" && a.UserID == PostDataD.UserID 
                        select new 
                        {
                            TID =a.TID,
                            Title = a.Title,
                            Category = a.Category,
                            InstanceKey = a.InstanceKey,
                            FormKey = a.FormKey,
                            UserID = a.UserID,
                            Status = a.Status,
                            Extend = a.Extend,
                            Add_Time = a.Add_Time
                        }).QueryByPage(up, "Add_Time desc");

            return new
            {
                code = "success",
                msg = "获取待办列表",
                data = new { CurrentPage = list.CurrentPage, TotalPage = list.TotalPage, TotalRow = list.TotalRow, QueryDatas = list.QueryData<FrameDLRObject>().Select( d=> { d.Add_Time = DateTimeStd.IsDateTimeThen(d.Add_Time,"yyyy-MM-dd HH:mm:ss"); return d; }) }
            };
        }

        [EWRAAuth(true)]
        [EWRARoute("post", "/WorkFlowTask/DoneList")] 
        [EWRAAddInput("UserID", "string", "用户ID", "", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("limit", "int", "页面条数", "10", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRAAddInput("page", "int", "当前页码", "1", EFFC.Frame.Net.Base.Constants.RestInputPosition.PostData, false)]
        [EWRARouteDesc("流程任务：获取已办列表")]
        [EWRAOutputDesc("返回结果", @"{
                    code:'success',
                     msg:'',
                     data:[
                         {
                            ID:记录ID， 
                            Name:客户名称 
                         }]
        }")]
        public object DoneList()
        {
            SetCacheEnable(false);
            var up = DB.NewMetaUnitParameter();
            var list = (from a in DB.LamdaTable(up, "EXTEND_WORK_FLOW_TASKS", "a")
                        where a.Status != "待办" && a.UserID == PostDataD.UserID 
                        select new
                        {
                            TID = a.TID,
                            Title = a.Title,
                            Category = a.Category,
                            InstanceKey = a.InstanceKey,
                            FormKey = a.FormKey,
                            UserID = a.UserID,
                            Status = a.Status,
                            Extend = a.Extend,
                            Add_Time = a.Add_Time
                        }).QueryByPage(up, "Add_Time desc");

            return new
            {
                code = "success",
                msg = "获取已办列表",
                data = new { CurrentPage = list.CurrentPage, TotalPage = list.TotalPage, TotalRow = list.TotalRow, QueryDatas = list.QueryData<FrameDLRObject>().Select(d => { d.Add_Time = DateTimeStd.IsDateTimeThen(d.Add_Time, "yyyy-MM-dd HH:mm:ss"); return d; }) }
            };
        }
    }
}
